package com.outsourcing.bottle.util;

import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.Date;
import java.util.UUID;
import java.util.Vector;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class FileManager {

	  /**
     * 添加日志
     * @param str
     * @return
     */
	public synchronized static boolean  addLog(String str)
	{   
		str=Utility.getTime(new Date(System.currentTimeMillis()))+"--------------->:"+str;
		System.out.println(str);
		str=str+" \n";
		FileOperation fp = null;
		try{
			fp = new FileOperation("Log", null);
			fp.initFile(Utility.getDate()+"log");
			if(fp.extraAddLine(str.getBytes()))
			{
				System.gc();
				return true;
			}else {
				
				System.gc();
				return false;
			}
		}catch (OutOfMemoryError error) {
			error.printStackTrace();
			return false;
		} catch(Exception e)
		{
			e.printStackTrace();
			return false;
		}finally
		{
			if(fp!=null)
			{
				fp.closeFile();
			}
		}
	}
	
	
}

